package com.example.lc.mythreedemo;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import java.util.List;

/**
 * 名片模版选择界面
 *
 * @author lc
 */
public class SelectNameCardTemplateAdapterTwo extends BaseAdapter {
    public void setColl(List<EnterpriseHomeEntity> coll) {
        this.coll = coll;
    }

    private List<EnterpriseHomeEntity> coll;// 列表数据
    private Context ctx;
    private LayoutInflater mInflater;

    public SelectNameCardTemplateAdapterTwo(Context context, List<EnterpriseHomeEntity> coll) {
        ctx = context;
        this.coll = coll;
        mInflater = LayoutInflater.from(context);
    }

    public int getCount() {
        return 5;
    }

    public Object getItem(int position) {
        return coll.get(position);
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        final EnterpriseHomeEntity entity = coll.get(position);
        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = mInflater.inflate(
                    R.layout.item_my_all_name_card, null);
            viewHolder = new ViewHolder();
            viewHolder.iv_hean = (ImageView) convertView
                    .findViewById(R.id.iv_hean);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
//        Graphic.setViewWH(9,16,3,40,viewHolder.iv_hean);//设置图片宽高

        return convertView;
    }

    private class ViewHolder {
        public ImageView iv_hean;
    }

}
